package Gui;

import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.layout.FormAttachment;
import org.eclipse.swt.layout.FormData;
import org.eclipse.swt.layout.FormLayout;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Text;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.graphics.Rectangle;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;

/**
* This code was edited or generated using CloudGarden's Jigloo
* SWT/Swing GUI Builder, which is free for non-commercial
* use. If Jigloo is being used commercially (ie, by a corporation,
* company or business for any purpose whatever) then you
* should purchase a license for each developer using Jigloo.
* Please visit www.cloudgarden.com for details.
* Use of Jigloo implies acceptance of these licensing terms.
* A COMMERCIAL LICENSE HAS NOT BEEN PURCHASED FOR
* THIS MACHINE, SO JIGLOO OR THIS CODE CANNOT BE USED
* LEGALLY FOR ANY CORPORATE OR COMMERCIAL PURPOSE.
*/

/**
* Description :show a details 
* <p>
*
*@author Danielle 
*/

public class Details extends org.eclipse.swt.widgets.Composite {
	private Composite allView;
	private Text detailsText;
	private Button cancel;
	private Label detailsLable;
	static Shell shell;
	private static String discriptiom;

	
	
	/**
	* Overriding checkSubclass allows this class to extend org.eclipse.swt.widgets.Composite
	*/	
	protected void checkSubclass() {
	}
	
	/**
	* Auto-generated method to display this 
	* org.eclipse.swt.widgets.Composite inside a new Shell.
	*/
	public static void showGUI(String disc) {
		Display display = Display.getDefault();
		shell = new Shell(display);
		discriptiom=disc;
		Details inst = new Details(shell, SWT.NULL);
		Point size = inst.getSize();
		shell.setLayout(new FillLayout());
		shell.layout();
		if(size.x == 0 && size.y == 0) {
			inst.pack();
			shell.pack();
		} else {
			Rectangle shellBounds = shell.computeTrim(0, 0, size.x, size.y);
			shell.setSize(shellBounds.width, shellBounds.height);
		}
		shell.open();
		while (!shell.isDisposed()) {
			if (!display.readAndDispatch())
				display.sleep();
		}
	}

	public Details(org.eclipse.swt.widgets.Composite parent, int style) {
		super(parent, style);
		initGUI();
	}

	private void initGUI() {
		try {
			FormLayout thisLayout = new FormLayout();
			this.setLayout(thisLayout);
			{
				allView = new Composite(this, SWT.NONE);
				FormLayout allViewLayout = new FormLayout();
				FormData allViewLData = new FormData();
				allViewLData.left =  new FormAttachment(0, 1000, 0);
				allViewLData.top =  new FormAttachment(0, 1000, 0);
				allViewLData.width = 800;
				allViewLData.height = 286;
				allView.setLayoutData(allViewLData);
				allView.setLayout(allViewLayout);
				{
					cancel = new Button(allView, SWT.PUSH | SWT.CENTER);
					FormData cancelLData = new FormData();
					cancelLData.left =  new FormAttachment(0, 1000, 370);
					cancelLData.top =  new FormAttachment(0, 1000, 216);
					cancelLData.width = 67;
					cancelLData.height = 24;
					cancel.setLayoutData(cancelLData);
					cancel.setText("cancel");
					cancel.addSelectionListener(new SelectionAdapter() {
						public void widgetSelected(SelectionEvent evt) {
							shell.dispose();
							//TODO add your code for cancel.widgetSelected
						}
					});
				}
				{
					detailsLable = new Label(allView, SWT.NONE);
					FormData detailsLableLData = new FormData();
					detailsLableLData.left =  new FormAttachment(0, 1000, 24);
					detailsLableLData.top =  new FormAttachment(0, 1000, 23);
					detailsLableLData.width = 179;
					detailsLableLData.height = 20;
					detailsLable.setLayoutData(detailsLableLData);
					detailsLable.setText("Details About The Algorithm:");
				}
				{
					detailsText = new Text(allView, SWT.NONE);
					FormData detailsTextLData = new FormData();
					detailsTextLData.width = 755;
					detailsTextLData.height = 96;
					detailsTextLData.left =  new FormAttachment(25, 1000, 0);
					detailsTextLData.right =  new FormAttachment(976, 1000, 0);
					detailsTextLData.top =  new FormAttachment(173, 1000, 0);
					detailsTextLData.bottom =  new FormAttachment(508, 1000, 0);
					detailsText.setLayoutData(detailsTextLData);
					detailsText.setText(discriptiom);

				}
			}
			this.layout();
			pack();
		} catch (Exception e) {
			e.printStackTrace();
		}
	}

}
